﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Scarecrow_Network_Manager
{
    /// <summary>
    /// Logica di interazione per frmErrorReporter.xaml
    /// </summary>
    public partial class frmErrorReporter : Window
    {
        Exception exc;
        public frmErrorReporter(Exception exc)
        {
            InitializeComponent();
            this.exc = exc;
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            txtErrorName.Text = this.exc.Message;
            txtError.Text = string.Format("Source:{0}{1}{0}{0}Inner Exception:{0}{2}{0}{0}Stack Trace:{0}{3}{0}{0}Target Site:{0}{4}{0}{0}Help Link:{0}{5}{0}{0}",
                Environment.NewLine, 
                this.exc.Source, 
                this.exc.InnerException, 
                this.exc.StackTrace, 
                this.exc.TargetSite, 
                this.exc.HelpLink);
        }

        private void cmdClose_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
        {
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(e.Uri.AbsoluteUri));
            e.Handled = true;
        }

        private void Window_Closed(object sender, EventArgs e)
        {
            System.Diagnostics.Process.GetCurrentProcess().Kill();
        }
    }
}
